/*
 * Created on 2004/08/19
 * Author aki@www.xucker.jpn.org
 * License Apache2.0 or Common Public License
 */
package jp.sourceforge.akjrcp.util;

import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Display;

/**
 * 
 *@deprecated use akjava.com
 */
public class ClipboardUtil {
	//setContents
	 public static void setClipboard(Display display,String text){
		 Clipboard cp= new Clipboard(display);
		 cp.setContents(new Object[]{text},
                 new Transfer[]{TextTransfer.getInstance()});
	 }
    public static String getCurrentText(Display display){
        String result=null;
        Clipboard cp= new Clipboard(display);
        TextTransfer transfer=TextTransfer.getInstance();
        
        String v[]=cp.getAvailableTypeNames();
        
        for(int i=0;i<v.length;i++){
           if(v[i].equals("CF_TEXT")){
               result= (String)cp.getContents(transfer);
           }
        }
        v=null;
        transfer=null;
        cp.dispose();
        return result;
    }
}
